package com.hgc.ch01.pool;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * Created by 01367627 on 2019/6/27.
 */
public class ConnectionFactory {

    private static String driverClass = "com.mysql.jdbc.Driver";
    private static String url = "jdbc:mysql://192.168.2.129:3306/ch01?useSSL=false";
    private static String username = "root";
    private static String password = "123456";

    public static Connection createConnection(){
        Connection connection = null;
        try {
            Class.forName(driverClass);
            connection = DriverManager.getConnection(url,username,password);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return connection;
    }

}
